﻿using mediaPrime.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace mediaPrime.Core.Dialogs
{
    /// <summary>
    /// Interaktionslogik für ExitDialog.xaml
    /// </summary>
    public partial class ExitDialog : MPDialog
    {
        public ExitDialog()
        {
            InitializeComponent();

            var menuList = new List<MPMenuItemBase>();
            menuList.Add(new MPMenuItem("Exit"));
            menuList.Add(new MPMenuItemSeparator());
            menuList.Add(new MPMenuItem("Shutdown", false));
            menuList.Add(new MPMenuItem("Restart", false));
            menuList.Add(new MPMenuItem("Standby", false));
            menuList.Add(new MPMenuItemSeparator());
            menuList.Add(new MPMenuItem("Cancel"));

            menuControl.ItemsSource = menuList;
        }

        private void menuControl_MenuItemClicked(object sender, MPMenuItemClickedEventArgs e)
        {
            var menuItem = e.Item as MPMenuItem;

            switch (menuItem.Content as string)
            {
                case "Cancel": Close(); break;
                case "Exit":
                    Close();
                    Application.Current.MainWindow.Close();
                    break;
            }
        }
    }
}
